package com.honeybee.cloud.framework.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description 方法请求类型
 * @Author DELL
 * @Create 2019-02-15
 * @Since 1.0.0
 */
public enum MethodTypeEnum {
    GET(1),
    POST(2),
    DELETE(3),
    PUT(4),
    HEAD(5),
    PATCH(6),
    OPTIONS(7),
    TRACE(8), UN_KNOW(9);

    private int value;
    private static final Map<Integer, MethodTypeEnum> ENUM_MAP = new HashMap(values().length);

    MethodTypeEnum(int value) {
        this.value = value;
    }

    public static MethodTypeEnum fromValue(Integer value) {
        MethodTypeEnum methodTypeEnum = ENUM_MAP.get(value);
        return methodTypeEnum == null?UN_KNOW:methodTypeEnum;
    }

    public int value() {

        return this.value;
    }

    static {
        MethodTypeEnum[] var0 = values();
        int var1 = var0.length;

        for (int var2 = 0; var2 < var1; ++var2) {
            MethodTypeEnum methodEnum = var0[var2];
            ENUM_MAP.put(methodEnum.value, methodEnum);
        }

    }
}
